package com.cskaoyan;

import com.cskaoyan.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

// 删
public class DeleteJDBCDemo {

    public static void main(String[] args) throws SQLException {

        // 获取连接
        Connection connection = JDBCUtils.getConnection();

        // 获取statement对象
        Statement statement = connection.createStatement();

        // 执行SQL
        int affectedRows = statement.executeUpdate("delete from stu where id > 5");

        System.out.println("affectedRows:" + affectedRows);

        JDBCUtils.closeResources(connection,statement,null);

    }
}
